﻿$(function () {
    datePicker("#d_LeaveDate");
    datePicker("#InTime1");
    datePicker("#InTime2");
    //initTable(".tblStyle1");
})
function setState(tourTeamPlanID, state) {
    $("#TourTeamPlanID").val(tourTeamPlanID);
    goto(state);
}

function goto(act) {
    $("#PageIndex").val("1");

    $("#act").val(act);
    document.forms[0].submit();
}

function showRoom(hotelID) {
    $("#roomList" + hotelID).toggle();
}


function ShowBar(src, tourTeamPlanID, objName) {

    if ($(src).attr("isInit") == undefined) {
        $(src).attr("isInit", "1");
    }
    else {
        return;
    }

    var objHtml;
    var parm = "tourTeamPlanID=" + tourTeamPlanID + "&objName=" + objName;
    var htmlHead = "<div class='boxsss' style=''><ul>";
    var htmlFoot = "</ul></div>";
    var jsonStr = "";

    $.ajax({
        url: "/TourTeamPlan/GetTourTeamPlanInfoByJson",
        type: "post",
        dataType: "json",
        data: parm,
        success: function (json) {
            if (json.length == 0) return;

            jsonStr = "";
            switch (objName) {
                case "Guide":

                    for (var i = 0; i < json.length; i++) {
                        jsonStr += "<li><font color='white'>" + json[i].TourGuideName + " " + json[i].Mobile + "</font></li>";
                    }
                    objHtml = htmlHead + jsonStr + htmlFoot;
                    $(src).append(objHtml);

                    return;

                case "Car":
                    for (var j = 0; j < json.length; j++) {
                        jsonStr += "<li><font color='white'>" + "【" + json[j].CarCompanyName + "】" + json[j].Chauffeur + " " + json[j].CarSeatCount + "座" + json[j].CarNumber + "</font></li>";
                    }
                    objHtml = htmlHead + jsonStr + htmlFoot;
                    $(src).append(objHtml);
                    return;

                case "Hotel":
                    for (var k = 0; k < json.length; k++) {
                        jsonStr += "<li><font color='white'>" + "【" + json[k].InShortDate + "】" + json[k].InDateWeekStr + " " + json[k].HotelName + "</font></li>";
                    }
                    objHtml = htmlHead + jsonStr + htmlFoot;
                    $(src).append(objHtml);

                    return;

                case "Restaurant":
                    for (var n = 0; n < json.length; n++) {
                        jsonStr += "<li><font color='white'>" + "【" + json[n].RestaurantName + "】" + json[n].AdultPrice + "*" + json[n].AdultCount + "儿童:" + json[n].ChildrenPrice + "*" + json[n].ChildrenCount + "</font></li>";

                    }
                    objHtml = htmlHead + jsonStr + htmlFoot;
                    $(src).append(objHtml);

                    return;

                case "Calendar":
                    for (var m = 0; m < json.length; m++) {
                        jsonStr += "<li><font color='white'>" + "【" + json[m].DinnerDate + "】" + json[m].DinnweekStr + " " + json[m].HotelPlace + " " + json[m].DinnStr + "</font></li>";
                    }
                    objHtml = htmlHead + jsonStr + htmlFoot;
                    $(src).append(objHtml);

                    return;
                case "Scenery":
                    for (var s = 0; s < json.length; s++) {
                        jsonStr += "<li><font color='white'>" + "【" + json[s].TravelDateStr + "】" + json[s].TravelDateWeekStr + " " + json[s].SceneryName + "</font></li>";
                    }
                    objHtml = htmlHead + jsonStr + htmlFoot;
                    $(src).append(objHtml);
                    return;
                case "Shop":
                    for (var h = 0; h < json.length; h++) {
                        jsonStr += "<li><font color='white'>" + "【" + json[h].ShoppingTimeStr + "】" + json[h].ShopName + "</font></li>";
                    }
                    objHtml = htmlHead + jsonStr + htmlFoot;
                    $(src).append(objHtml);
                    return;
                case "Ticket":
                    for (var t = 0; t < json.length; t++) {
                        jsonStr += "<li><font color='white'>" + "【" + json[t].BeginTimeStr + "】" + json[t].TicketNo + " " + json[t].LeavePlace + "—" + json[t].LeavePlace + " " + json[t].ClientName + "</font></li>";
                    }
                    objHtml = htmlHead + jsonStr + htmlFoot;
                    $(src).append(objHtml);
                    return;
                case "Customer":
                    for (var c = 0; c < json.length; c++) {
                        jsonStr += "<li><font color='white'>" + "【" + json[c].ClientName + "】" + json[c].Operator + " " + json[c].LinkmanMobile + " " + json[c].Quantity + "<sup>+" + json[c].Quantity1 + "+" + json[c].GuideQuantity + "</sup>" + "</font></li>";
                    }
                    objHtml = htmlHead + jsonStr + htmlFoot;
                    $(src).append(objHtml);
                    return;
            }

        }
    });

}

function ConfirmDel(tourTeamPlanID) {
    $.Msg.confirmDelete(
             function () {
                 $("#act").val("delete");
                 $("#TourTeamPlanID").val(tourTeamPlanID);
                 document.forms[0].submit();
             }
        );
}
